﻿namespace Minecraft.Model.Enums
{
    /// <summary>
    /// 
    /// </summary>
    public enum EnumAchievementConditionType
    {
        /// <summary>
        /// 无
        /// </summary>
        None = 0,
        /// <summary>
        /// 玩家达到一定等级
        /// </summary>
        Level = 1,
        /// <summary>
        /// 解锁蓝图到一定数量
        /// </summary>
        Blue = 2,
        /// <summary>
        /// 解锁指定蓝图
        /// </summary>
        BlueId = 3,
        /// <summary>
        /// 击杀一定数量的生物
        /// </summary>
        Monster = 4,
        /// <summary>
        /// 击杀特定生物到一定数量
        /// </summary>
        MonsterIdNum = 5,
        /// <summary>
        /// 抵御尸潮攻击次数
        /// </summary>
        Def1 = 6,
        /// <summary>
        /// 抵御玩家攻击次数
        /// </summary>
        Def2 = 7,
        /// <summary>
        /// 攻破玩家基地次数
        /// </summary>
        Att = 8,
        /// <summary>
        /// 联机次数
        /// </summary>
        Connect = 9

    }


    /// <summary>
    /// 辅助工具
    /// </summary>
    public class EnumAchievementConditionTypeHelper
    {
        /// <summary>
        /// blue => EnumAchievementConditionType.Blue
        /// def1 => EnumAchievementConditionType.Def1 等转换
        /// </summary>
        /// <param name="desc"></param>
        /// <returns></returns>
        public static EnumAchievementConditionType ConditiontypeTransform(string desc)
        {
            if (string.IsNullOrEmpty(desc))
            {
                return EnumAchievementConditionType.None;
            }

            desc = desc.ToLower().Trim();
            switch (desc)
            {
                case "level":
                    return EnumAchievementConditionType.Level;
                case "blue":
                    return EnumAchievementConditionType.Blue;
                case "blueid":
                    return EnumAchievementConditionType.BlueId;
                case "monster":
                    return EnumAchievementConditionType.Monster;
                case "monsterid":
                    return EnumAchievementConditionType.MonsterIdNum;
                case "def1":
                    return EnumAchievementConditionType.Def1;
                case "def2":
                    return EnumAchievementConditionType.Def2;
                case "att":
                    return EnumAchievementConditionType.Att;
                case "connect":
                    return EnumAchievementConditionType.Connect;
                default:
                    return EnumAchievementConditionType.None;
            }
        }


    }
}
